﻿namespace Chapter02.DesginMode1 {
    public class StatisticsDisplay : IObserver, IDisplayElement {
        public ISubjuect Subjuect { get; set; }

        public float Temperature { get; set; }

        public float Humidity { get; set; }

        public StatisticsDisplay(ISubjuect subjuect) {
            Subjuect = subjuect;
            Subjuect.RegisterObserver(this);
        }

        public void Update(float temperature, float humidity, float pressure) {
            Temperature = temperature;
            Humidity = humidity;
            Display();
        }

        public void Display() {
            Console.WriteLine($"Statistics: {Temperature}F degree and {Humidity}% humidity");
        }
    }
}
